package com.sly.demoim.controller;

import com.sly.demoim.model.message.ChatMessage;
import com.sly.demoim.result.BaseResult;
import com.sly.demoim.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 消息controller
 *
 * @author SLY
 * @date 2022/7/18
 */
@RestController
@RequestMapping("/message")
public class MessageController {

    @Autowired
    private MessageService messageService;

    /**
     * 发送聊天消息
     *
     * @param message 消息对象
     * @return {@link BaseResult}
     * @author SLY
     * @date 2022/7/24
     */
    @PostMapping("/sendChatMessage")
    public BaseResult<?> sendChatMessage(ChatMessage<?> message) {
        return messageService.sendChatMessage(message);
    }
}
